from code.util import path_util, str_util
from code.mode import doc_mode

def write_doc(table_info_list):
    print(f"table_info_list >> {table_info_list}")
    content_temp = doc_mode.content
    for param in table_info_list:
        content_temp += f"| {str_util.snake_to_camel(param[0]):<{20}} | {param[1]:<20} | {param[2]:<20} |\n"

    # 将内容写入到 test.txt
    # with open(path_util.BASE_DIR+"/doc.txt", "w", encoding="utf-8") as file:
    with open("./doc.txt", "w", encoding="utf-8") as file:
        file.write(content_temp)

    print("内容已成功写入到 doc.txt 文件。")